程序员面试题20xx

程序员面试题2015

不少程序员都会碰到的三个面试题

1. 求从10到100中能被3或5整除的数的和

2. 将一个字符串逆序,不要使用反转函数

3. 反转一个栈

问题解决的步骤和错误:

1. 解析问题,手工“解决”

(1)对于孩子和成年人而言,这一步对前者来说更困难

(2)然而,如果要求误解了问题的学生来重读这个问题,孩子们的表现会超过成年人

2. 想出一个伪代码算法

(1)在这一步,学生的表现比成年人要好。

(2)让人震惊的是,很多成年人不知道如何用他们偏好的编程语言从一个字符串中抽取一个字符。

3. 将算法转换为代码

(1)我们有一些C++程序员,他们不知道方括号以及一些C程序员,他们采用指针运算,但是却失败了。

(2)更让人吃惊的是,当他们允许查阅java API 文档 或者使用参考书,很多成年人无法找到合适的文档来帮助解决问题。

(3)的确,一些中学生已经忘了如何使用栈或者实例化一个队列,但是,所有人都能够在适当的时间内通过查阅找到解决办法。

(4)会写代码的成年人(曾经会)经常会超过时间限制。

有很多糟糕的代码编写者,即便你也是其中一个,也不要害怕

可以尝试下面的方法:

1. 不停练习,直到你能快速且正确地写出小的代码片段。没有任何理由用自己喜欢的语言写不出一个双循环。找一些带有例子的小的代码智力题,你能在一分钟以内理解这些问题。对这类问题做成百上千遍的练习(不仅仅是几十遍,切记!)。

2. 为课本上的每个算法写一个用例列表。一个共同的错误就是仅仅记住计算复杂度表。但是看一些算法的使用例子,例如 A*搜索在哪些地方使用,这比学习代码本身要有用的多。

3. 至少做一个能逼迫你使用与工作相关的接口/用例的大型项目。语言通常不是很重要,而且独自写一个大型工程能够强迫你去学新的设计模式以及远离遗留代码维护。代码面试是智力测试。所以它们很少关注具体的体系。

4. 让自己接触更优秀的程序员。随着 CS 岗位的快速增长,应对“柠檬市场”的当前解决办法就是技术面试。但是同样也有其他的方式来反映被面试者的信息。例如,对热点话题、博客、技术的知识可以反映出对重要问题的意识。类似地,对恐怖故事采用幽默的代码书写方式,可以反映出经验和处理新问题的能力。幸运的是,在线代码编写社区随处可见,所以唯一地障碍就是是否肯花时间和保持谦虚。

相关阅读:面试技巧——经典面试问题回答思路

面试过程中,面试官会向应聘者发问,而应聘者的回答将成为面试官考虑是否接受他的重要依据。对应聘者而言,了解这些问题背后的“猫腻”至关重要。本文对面试中经常出现的一些典型问题进行了整理,并给出相应的回答思路和参考答案。读者无需过分关注分析的细节,关键是要从这些分析中“悟”出面试的规律及回答问题的思维方式,达到“活学活用”。

问题一:“请你自我介绍一下”

思路: 1、这是面试的必考题目。 2、介绍内容要与个人简历相一致。 3、表述方式上尽量口语化。 4、要切中要害,不谈无关、无用的内容。 5、条理要清晰,层次要分明。 6、事先最好以文字的形式写好背熟。

问题二:“谈谈你的家庭情况”

思路: 1、 况对于了解应聘者的性格、观念、心态等有一定的作用,这是招聘单位问该问题的主要原因。 2、 简单地罗列家庭人口。 3、宜强调温馨和睦的家庭氛围。 4、 宜强调父母对自己教育的重视。 5、 宜强调各位家庭成员的良好状况。 6、 宜强调家庭成员对自己工作的支持。 7、 宜强调自己对家庭的责任感。

问题三:“你有什么业余爱好?”

思路: 1、业余爱好能在一定程度上反映应聘者的性格、观念、心态,这是招聘单

位问该问题的主要原因。 2、 最好不要说自己没有业余爱好。 3、不要说自己有那些庸俗的、令人感觉不好的爱好。 4、 最好不要说自己仅限于读书、听音乐、上网,否则可能令面试官怀疑应聘者性格孤僻。 5、最好能有一些户外的业余爱好来“点缀”你的形象。

问题四:“你最崇拜谁?”

思路: 1、最崇拜的人能在一定程度上反映应聘者的性格、观念、心态,这是面试官问该问题的主要原因。 2、 不宜说自己谁都不崇拜。 3、 不宜说崇拜自己。 4、 不宜说崇拜一个虚幻的、或是不知名的人。 5、 不宜说崇拜一个明显具有负面形象的人。

6、所崇拜的人人最好与自己所应聘的工作能“搭”上关系。 7、 最好说出自己所崇拜的人的哪些品质、哪些思想感染着自己、鼓舞着自己。

问题五:“你的座右铭是什么?”

思路: 1、座右铭能在一定程度上反映应聘者的性格、观念、心态,这是面试官问这个问题的主要原因。 2、不宜说那些医引起不好联想的座右铭。 3、不宜说那些太抽象的座右铭。 4、不宜说太长的座右铭。 5、座右铭最好能反映出自己某种优秀品质。

6、 参考答案——“只为成功找方法,不为失败找借口”

问题六:“谈谈你的缺点”

思路: 1、不宜说自己没缺点。 2、 不宜把那些明显的优点说成缺点。 3、 不宜说出严重影响所应聘工作的缺点。 4、 不宜说出令人不放心、不舒服的缺点。 5、 可以说出一些对于所应聘工作“无关紧要”的缺点,甚至是一些表面上看是缺点,从工作的角度看却是优点的缺点。

问题七:“谈一谈你的一次失败经历”

思路: 1、 不宜说自己没有失败的经历。 2、 不宜把那些明显的成功说成是失败。

3、不宜说出严重影响所应聘工作的失败经历, 4、 所谈经历的结果应是失败的。 5、 宜说明失败之前自己曾信心白倍、尽心尽力。 6、说明仅仅是由于外在客观原因导致失败。 7、 失败后自己很快振作起来,以更加饱满的热情面对以后的工作。

问题八:“你为什么选择我们公司?”

思路: 1、 面试官试图从中了解你求职的动机、愿望以及对此项工作的态度。 2、 建议从行业、企业和岗位这三个角度来回答。 3、 参考答案——“我十分看好贵公司所在的行业,我认为贵公司十分重视人才,而且这项工作很适合我,相信自己一定能做好。”

问题九:“对这项工作,你有哪些可预见的困难?”

思路: 1、 不宜直接说出具体的困难,否则可能令对方怀疑应聘者不行。 2、可

以尝试迂回战术,说出应聘者对困难所持有的态度——“工作中出现一些困难是正常的,也是难免的,但是只要有坚忍不拔的毅力、良好的合作精神以及事前周密而充分的准备,任何困难都是可以克服的。”

问题十:“如果我录用你,你将怎样开展工作”

思路: 1、 如果应聘者对于应聘的职位缺乏足够的了解,最好不要直接说出自己开展工作的具体办法, 2、可以尝试采用迂回战术来回答,如“首先听取领导的指示和要求,然后就有关情况进行了解和熟悉,接下来制定一份近期的工作计划并报领导批准,最后根据计划开展工作。”

 

第二篇:RPGIV 程序员面试题

RPGIV 程序员面试题

1. function key CA 与 CF 的区别;

CF return screen and indicator, CA indicator only

If you use CAnn instead of CFnn, this will happen because of the way the I/O buffer is validity checked by the RPG runtime. When the user uses a CF key/ENTER/etc. the current display values are moved to this WB and verified. Don't use CA keys or Don't use functions such as VALUES, RANGE, CHECK(VN), etc.

2. dataQ 与 data area 的区别;

1).两种语言交流比dataarea,message queue 有效

2) 速度快,特别是多个用户,比批处理快

3) 多任务,先进先出,后进先出等,键方式,多种形式

4) 可以发用户名,任务名

5) 有time out,过期不处理

3. chain 与 reade 的区别;

Reade use file path and can use next order record, chain use directly

What's the difference between CHAIN and SETLL? Is there a performance advantage?

(1) The CHAIN operation applies a record lock to files that are open or update. The SETLL operation does not apply the lock.

(2) The CHAIN operation copies the record's data to the input buffer for the program. The SETLL operation does not.

The CHAIN operation performs a random GET operation to the database file. If the operation is successful, the data in the record is copied to the input buffer. The SETLL operation performs a quasi READ LESS THAN OR EQUAL operation. is not copied to the input buffer, nor is there a record lock applied to the accessed record. Hence, SETLL is probably the operation code to use for testing the existence of a record.

4. callb 与 callp 的区别

CALLB is a bound call for module and service program module

CALLP is for procedures When CALLP is used must be a code procedure prototype in the D-Spec. The main difference between CALLP and using the procedure in an expression is the lack of a return value. If a procedure does not return a value,

CALLP (or CALLB - call bound) must be used. If a procedure does return a value, it will be ignored using the CALLP operation.

5. 一个RPG程序中打开文件的最大数是多少?(RPG和RPGLE)

no limited

6. RPG程序中一个字符型变量的长度是多少?

65535

7. 数字型数组的求和操作符是什么?

XFOOT

8. 使用RPG程序,C表中非要写代码吗?

No

9. reset和CLEAR的用法和区别?

REset to inzsr, clear last value

10. *cat, *tcat, *bcat区别?

*CAT (concatenation) 'ABC ' *CAT 'DEF ' becomes 'ABC DEF '

*BCAT (concatenation with blank insertion) 'ABC ' *BCAT ‘DEF ‘ becomes 'ABC DEF'

The *TCAT operator truncates all trailing blanks in the first character string, then the two character strings are concatenated. All leading blanks on the second operand are not truncated

'ABC '*TCAT ' DEF' becomes 'ABC DEF'

11. RPG程序最多能定义多少个SUBFILE?自己最多有做个多少级的SUBFILE文件?

no limited

12. RPG程序的流程是什么?

RT -à *ENTRY --à DS à U1-U8 –〉open à *INZSR -à *DETAIL à *GETIN (input)

13. 如何读取一个文件的最后一条记录 (两个操作代码)

Setgt/readp

14. 在 CL 中如何获得用户名 ?

RTVUSRPRF

15. RPGLE的内置函数的优点,起列举6个加以说明.

%equal %found %eof %error %status %date %subst()

16. Explain what Data queues are.

Data Queues are a cross between data areas, and message queues. They are a method for asynchronous communication between programs. A typical use for a data queue is to have a job sitting in a batch subsystem waiting for a data queue entry to be created, and multiple programs dropping entries into the data queue.

17. How can you change data area from an RPG PGM?

You can use QCMDEXC API and code the CHGDTAARA command in it and then CALL the API. You will have to use an array to put the command CHGDTAARA in it to pass to the API

18. How to submit a job via RPG.

USE QCMDEXC and define parm in array at the bottom of the RPG. Pass the command to QCMDEXC to call any CL/400 command

19. How to call CL from RPG:

Call qcmdexc and use parm to pass to this api

20. What is the sql code to update data from program?

C/EXEC SQL

C+ UPDATE Statement

C/END-EXEC

21. What will be the pgm. Type of embedded SQL in RPG & ILE RPG.

SQLRPG

SQLRPGLE

22. example use Embedded SQL RPG.

C/Exec SQL

C+ DECLARE doglist Cursor For

C+ Select * From Dogpf

C+ Where dognm = :dogname

C/End-Exec

C/Exec SQL

C+ Open doglist

C/End-Exec

C/FREE

Dou eof();

C/Exec SQL

C+ Fetch Next From doglist

C+ Into :dogsubfilerecord;

C/End-Exec

Write dogsubfilerecord;

Enddo;

C/end-free;

C/EXEC SQL CLOSE doglist

C/END-EXEC

Embedded SQL is certainly about 10 to 20 times faster than Query in an application. I would definitely recommend its use when a logical file is impractical.

23. IF WE HAVE LIST OF BOOK (I.E. ENGLISH, FRENCH) HOW WE CALCULATE HOW MENY BOOKS WE HAVE FOR ENGLISH.

SELECT COUNT(*) FROM book WHERE language="English" order by Subject.

24. What are some data types? This is in Physical Files

P = Packed Decimal Data

S = Zoned Decimal Data

L = Date Data

T = Time Data

Z = Time Stamp Data

A=char

25. SQL Statement to find duplicates in file

Select cust#, count(*) from cusmas where cus# having count(*) > 1

(Here cust# is customer # and cusmas is the file. This statement will give you cust# which is duplicate in cusmas)

26. Distinct will only give you one record out of 2 duplicate records in SQL Select duplicate record from the file:

SELECT DISTINCT (FIELD) FROM ABC WHERE NAME ='NASEER'

27. How many files can be used in CL.?

ONE. (Using DCLF and then RCVF command. In V5R3, you can use multiple files)

Sndf , rcvf, sndrcvf

28. How can we update data area?

CHGDTAARA

29. How can we find a number of records in PF

Rtvmbrd (NBRCURRCD) then file

30. How u can find in a CL Pgm, no of records in a physical file.

RTVMBRD command and use the keyword NBRCURRCD

31. How can i send message to a user.

sndusrmsg

32. How can i send message to the user with time and date.

Retrieve time and concatenate with message then SNDUSRMSG.

33. how to convert Numeric data into String:

%DIGIT

34. In SQL how you compare character field to a numeric field.

By using %DIGITS. I will try first to move the numeric field to a character field in order

To compare only character fields.

35. if two pf have same field name, how to use in RPG.

Use PRIFIX op-code with the file in file definition.

36. if we have 5 logical on one pf, how can we use in RPG;

Use Rename RECORD FORMAT in file definition.

37. If we move *HIVAL to a "Z" type field, what will be the value.

It would be '999999'

38. Multi-occurrence data structure

How to define multi-occurance data structures and what is the purpose. Name ds occurs(18)

Subname1 20A

Subname2 10A

Twodimension DS occurs(10)

Arr 10 dim(10)

39. What if your SQL results are not coming correct?

Due to selection criteria not being correct or the file is not in the correct library.

40. How to look at Interactive and Batch job? WRKACTJOB, WRKUSRJOB, DSPJOB, WRKJOB

41. How to calculate differences in dates in RPG?

You will have to use ADDDUR and SUBDUR op-codes in RPG ILE

42. What is bound program? How is it different from RPG400?

Bound RPG is a module that is created using CRTBNDRPG command. You can call Modules or Service Programs using CALLB. Normal RPG program uses CALL statement.

43. WRKBNDDIR AND WRKBNDDIRE

CRTBNDDIR to create a new binding directory, and the commands WRKBNDDIR (with with binding directories) and WRKBNDDIRE (with with binding directory entries) to change the binding directories.

a binding directory is very similar to a library list. However instead of containing a list of libraries, it contains a list of service programs and/or modules.

44. what is signature in server program

A signature in this sense is very similar to a record format level identifier. If a record format changes and the program is not re-compiled, you will get a level check error which is very similar to a signature violation.

45. CRTBNDDIR – Binding Types – By Copy or By Reference

By reference

46. Procedures and Sub-procedures

A procedure is a routine that is called using a bound call. You can create two kinds of procedures in RPG: a main procedure and a sub-procedure.

A main procedure uses the RPG cycle.The parameters for the main procedure can be coded using a prototype and procedure interface in the global Definition specifications, or using a *ENTRY PLIST in the main procedure's calculations.

A subprocedure is a procedure specified after the main source section. It can only be called using a bound call.

· You can pass parameters to a subprocedure, even passing by value · You can call subprocedures recursively

47. A CL program is executing OPNQRYF in a file and the program that is called after the OPNQRY is not getting the records those are selected by the OPNQRY , then what is wrong in this case.

(1) Shared open data path (ODP ) ovrdbf must be share(*YES)

(2) file is closed

(3) Level check.

(4) The file is at end of file

(5) No records

(6) Opnqryf syntax errors

48. There is a field called time stamp in a table and how to find all

the records that have been updated in last 10 minutes.

49. How to look at the batch or interactive job.

Rtvjoba type=0 is batch job, 1=interactive job

50. What command do you use to check or see if the job has completed successfully. Rtvjoba status =0

51. In the command OPNQRYF, How do you know if the command failed or successful.

The Display Job (DSPJOB) command is your most useful tool if problems occur.

52. What command do you use to get the date / time.

53. What is Syntax of Do While and what is different between Do While and Do Until do while will stop loop when condition is false, do until stop loop when condition is true

do until run at least one time

54. What is prototype?

the mainline source we also need the counterpart to the procedure interface - the procedure prototype

55. what is procedures pass parameters casted ?

ILE procedures pass parameters by reference as well, but with one key exception. If the parameters are the same general type as expected (alpha, numeric, date, etc.) but differ in their attributes (length, packed vs. zoned, *iso vs. *usa), the attributes will automatically be converted (casted).

56. What are service programs?

A service program is a collection of runnable procedures and available data items easily and directly accessible by other ILE programs or service programs. Service programs provide common services that other ILE objects may need; hence the name service program.

57. sbmjob and schedule 提交任务区别

A. sbmjob 使用current libl/ schedule 用 jobd libl

B sbmjob can use LDA / schedule can’t use LDA

C sbmjob one time call only / schedule call repeat

D sbmjob call on time / schedule may delay if other job use qbatch queue

58. What this command STRSRVJOB do.

Use strsrvjob when debug batch or remote program

59. What is level check?

File version signature , detect if any change file version

60. How can you handle exceptions in Read, Write, in RPG IV without using indicators?

When you or the system send an exception message, exception processing begins. This processing continues until the exception is handled, which is when the exception message is modified to indicate that it has been handled.

61. Can we debug CL program in Batch. =strsrvjob

62. Can a Physical File have multiple record formats no

63. Can a Logical File have multiple record formats of different physical file =yes

64. How do you combine two files using SQL

Select * from file1 join by (Select * from file2)

65. How do you Check the Existence of Records in an RPG program without performing a READ?

Setll and %found

66. What other way can you display all interactive jobs on the AS/400 without doing a WRKACTJOB QINTER?

wrksbsjob *qinter

67. How do you delete a line of code in SEU?" When he answered how, he was told he was wrong, the correct answer is "You never delete a line of code. You comment it out."

68. what sequence for communicate device ?

line, controller, device, mode

69. chang device configuration need what authority ?

*iosyscfg

70. where can we define the time slice ?

class

71. sbsystem ?

1 attribute , name, description, maxima job

2 pool, storage pool, *base, interact, private pool , maxima job in pool

3 work entry ,--- workstation, jobq, communication, autostart, prestart

4 routing entry, class(priority, time slice), routing data, program

72. what different are between array and table ?

table must be TAB+name, array can't be TAB+name

Tables can be loaded only at compilation time and prerun-time

· You can refer to a specific array element by its position

· You cannot refer to specific table elements by their position · An array name by itself refers to all elements in the array

· A table name always refers to the element found in the last lookup

73. how many type of array are there in definition?

(1) The run-time array is loaded by your program while it is running. DIM(number) ,Name, Data type, Decimal positions, ASCEND, DESCEND

(2) The compile-time array is loaded when your program is created.

CTDATA. PERRCD(entries in an input record) ,extfmt, tofile( output when LR) DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords++++++++++++++++++++

DARC S 3A DIM(12) PERRCD(5) CTDATA

**CTDATA ARC

48K16343J64044HComments can be placed here

12648A47349K346Comments can be placed here

50B125 Comments can be placed here

(3) The prerun-time array is loaded from an array file when your program begins running

* Prerun-time array specified as a combined file. ARH is written

* back to the same file from which it is read when the program

* ends normally with LR on. ARH has 250 character elements

* (12 elements per record). Each elements is five positions long.

* The elements are arranged in ascending sequence.

DARH S 5A DIM(250) PERRCD(12) ASCEND

D FROMFILE(DISKOUT)

D TOFILE(DISKOUT)

ALT, CTDATA, EXTFMT, FROMFILE, PERRCD, and TOFILE cannot be used for a run-time

Load run time array from file field = 12Char, 6 elements

*...1....+....2....+....3....+....4....+....5....+....6....+....7...

DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++

DINPARR S 12A DIM(6)

IFilename++SqNORiPos1+NCCPos2+NCCPos3+NCC................................ I........................Fmt+SPFrom+To+++DcField+++++++++L1M1FrPlMnZr.... IARRFILE AA 01

I 1 72 INPARR

Or

DARRX S 12A DIM(6)

IFilename++SqNORiPos1+NCCPos2+NCCPos3+NCC................................ I........................Fmt+SPFrom+To+++DcField+++++++++L1M1FrPlMnZr.... IARRFILE AA 01

I 1 12 ARRX(1)

I 14 25 ARRX(2)

I 27 38 ARRX(3)

I 40 51 ARRX(4)

I 53 64 ARRX(5)

I 66 77 ARRX(6)

74. what different between sbmjob and schedule ?

1) sbmjob can submit one time only ,schedule user repeat

2) sbmjob submit job exact time, schedule has time gap, if there are different with same submit time

3) sbmjob user current library list , schedule use jobd lib list

4) sumjob can copy the lda into job, schedule can't use LDA data

75. What is a difference between RPG IV and RPG ILE.

RPG IV is simply the next version of RPG. has a whole host of improvements over RPG III (also known as RPG/400)

ILE on the other hand is a set of functionality that exists across multiple programming languages (C, CL, Cobol). ILE stands for Integrated Language Environment. It gets it's name from the ability to create a single program using multiple programming languages.

76. RPG IV 特点?

1) proceduce and subprocedure

2) modular, small component

3) service program

4) Longer field names

5) Source level debugging

6) Date and time support

7) Additional data types (floating point, boolean, pointers)

8) Free-format expressions

9) Built in functions

10) Case tolerance

77. CL程序共可以声明几种变量类型,那几种是版本5.3以后新增的功能? *DEC *CHAR *LGL *PTR *INT *UINT 其中 *INT UINT 是新增的

78. CL 的三大函数是什么 ?

%SST (var,str, length) %BIN(char)=二进制 %SWITCH(8 Char)

79. how is the length of field name

4096

80 what is the difference of H between RPG/400, RPGIV

Header) specification allow you specify global parameters for how your program functions and is compiled. RPG III allowed one H-spec per program with the positional parameters.

RPG IV on the other hand uses free-form keywords for these parameters. Multiple H-specs may be used, and the keywords may be specified in any order.

88. how does a program look for environment without H-spec.

If an H-spec is included in the program, it will override any external H-specs in data areas.

If no H-spec is included however, the compiler will look for a data area named

RPGLEHSPEC in your library list. There can be multiple data areas with this name in different libraries.

If RPGLEHSPEC is not found in the library list, the compiler will look for a data area named DFTLEHSPEC in library QRPGLE.

The data areas must be type character, and can be whatever length you need.

81. can we define an array in a subprocedure ?

we can define only run-time arrays in a subprocedure. Tables, prerun-time arrays, and compile-time arrays are not supported. If you want to use a pre-run array or

compile-time array in a subprocedure, you must define it in the main source section

82. D-spec definition specification position 24 25

DS- define a data-structure. The sub-fields of a data structure should have these positions blank.

C- a named constant. The keyword CONST(value) is then used to identify the value of the constant.

S - Stand-alone fields. The keyword INZ(value) may be used to initialize the value of a stand-alone field.

PI/PR - define procedure interfaces and prototypes.

91. how many date format use in rpgIV program

RPGIV程序员面试题

83. Activation groups *NEW *CALLER QILE 有什么区别

*NEW 退出程序删除

*CALLER calling program closed

Default group, user job ended

相关推荐